package main

import (
	"encoding/json"
	"fmt"
)

type stu struct {
	Name  string
	Age   int
	score int
}

type stu2 struct {
	Name  string `json:"name"`
	Age   int `json:"age"`
	Score int `json:"score"`
}

func main() {
	var s1 stu
	var s2 *stu = new(stu)
	s3 := new(stu)
	s4 := stu{
		Name:  "Tom",
		Age:   18,
		score: 90,
	}
	fmt.Println(s1, s2, s3, s4)

	s5:= stu2{
		Name:  "Tom",
		Age:   18,
		Score: 90,
	}
	rs, err := json.Marshal(s4)
	if err != nil {
		fmt.Printf("oh, error:%v", err)
	} else {
		fmt.Printf("stu4:%s\n", string(rs))
	}

	rs, err = json.Marshal(s5)
	if err != nil {
		fmt.Printf("oh, error:%v", err)
	} else {
		fmt.Printf("stu5:%s\n", string(rs))
	}
}
